<?php

include 'D:/dingjiangbbs/common/home.php';

//屏蔽notice错误
error_reporting(E_ALL ^ E_NOTICE);

//var_dump($_POST);

//判断是否勾选选项
if (empty($_POST['$arrid'])) {

	exit('当前未勾选内容,请勾选选项');
}

//获取id的数组
$arrid = $_POST['$arrid'];

//将数组分割成字符串
$id    = implode(',',$arrid);
//var_dump($id);

//从数据库中,删除帖子
if ($_POST['post_rev'] == '恢复') {

	$table  = DB_TABLE_DETAIL;
	$data   = [
		'isdel' => 0
	];

	$where_rev = "id in ($id)";
	$res_rev   = update($link,$table,$data,$where_rev); 
	//var_dump($res_rev);

	//输出,跳转页面
	if (!$res_rev) {

		exit('<a href="'.WEB_SITE.'admin_cg.php?bighead=4&cg_number=8">恢复失败,返回继续操作</a>');
	}

	echo '<a href="'.WEB_SITE.'admin_cg.php?bighead=4&cg_number=8">恢复成功,返回继续操作</a>';
}

//恢复帖子,显示在管理栏中
if ($_POST['post_rev'] == '删除') {

	$table   = DB_TABLE_DETAIL;
	$where_del = "id in ($id)";
	$res_del = del($link,$table,$where_del);
	//var_dump($res_del);

	//输出,跳转页面
	if (!$res_del) {

		exit('<a href="'.WEB_SITE.'admin_cg.php?bighead=4&cg_number=8">删除失败,返回继续操作</a>');
	}

	echo '<a href="'.WEB_SITE.'admin_cg.php?bighead=4&cg_number=8">删除成功,返回继续操作</a>';

}


mysqli_close($link);